﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using UniversalShopAdmin.DataManager;

namespace UniversalShopAdmin.ViewModels.Admin
{
    public class UserViewModel
    {
        public string FirstName { get; set; }

        public string LastName { get; set; }

        public string Patronimic { get; set; }

        public DateTime DateRegistration { get; set; }

        public string UserName { get; set; }

        public string Password { get; set; }

        public Guid Idrole { get; set; }

        public int Phone { get; set; }

        public string Address { get; set; }

        public DateTime LastLogin { get; set; }
       
        public UserViewModel(User user)
        {
            this.FirstName = user.FirstName;
            this.LastName = user.LastName;
            this.Patronimic = user.Patronymic;
            if (user.DateReg != null) this.DateRegistration = user.DateReg.Value;
            this.UserName = user.Login;
            this.Password = user.Password;
            if (user.IdRole != null) this.Idrole = user.IdRole.Value;
            if (user.Phone != null) this.Phone = user.Phone.Value;
            this.Address = user.Address;
            if (user.LastLogin != null) this.LastLogin = user.LastLogin.Value;
        }

    }
}